﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace Bussiness
{
    public class manejadorPaises
    {
        public List<string> GetCountryList()
        {
            List<string> cultureList = new List<string>();
            Thread.CurrentThread.CurrentCulture = new CultureInfo("es-PE");

            Dictionary<string, string> objDic = new Dictionary<string, string>();
            foreach (CultureInfo ObjCultureInfo
              in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
            {
                RegionInfo objRegionInfo = new RegionInfo(ObjCultureInfo.Name);
                if (!objDic.ContainsKey(objRegionInfo.DisplayName))
                {
                    objDic.Add(objRegionInfo.DisplayName,
                    objRegionInfo.TwoLetterISORegionName.ToLower());
                }
            }
            var obj = objDic.OrderBy(p => p.Key);
            foreach (KeyValuePair<string, string> val in obj)
            {
                cultureList.Add(val.Key);
            }
            return cultureList;
        }
    }
}
